<html>
<head><meta charset="utf-8"><title>Import map · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html">Import map</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200240185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200240185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200240185">(Jun 09 2020 at 14:53)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> I see that you are adding fst to import map. If you want to use it during completion as well, you might, or might not need completion resolve request.</p>



<a name="200240304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200240304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200240304">(Jun 09 2020 at 14:54)</a>:</h4>
<p>This is <em>not</em> implemented at the moment, but it should allow to postone the computation of an edit until the moment the completion is actually selected.</p>



<a name="200240400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200240400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200240400">(Jun 09 2020 at 14:54)</a>:</h4>
<p>I think we probably should get by without one (my gut feeling is that we can't save a lot of work that way), but it's an important thing to be aware of.</p>



<a name="200242592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200242592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200242592">(Jun 09 2020 at 15:07)</a>:</h4>
<p>Ah, yes, I think I saw some comments about that</p>



<a name="200249028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200249028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200249028">(Jun 09 2020 at 15:46)</a>:</h4>
<p>Are there any tests for the symbol index by the way? I can't get the existing tests to fail when I try :D</p>



<a name="200249243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200249243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200249243">(Jun 09 2020 at 15:47)</a>:</h4>
<p>Good question! Seems like no? Which is a bit of a surprise, tbh :)</p>



<a name="200249327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200249327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200249327">(Jun 09 2020 at 15:48)</a>:</h4>
<p>In my defense, this is one of the oldest bits of rust-analyzer, which survived mostly intact :D</p>



<a name="200253284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200253284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200253284">(Jun 09 2020 at 16:12)</a>:</h4>
<p>Is there a way to get the files that comprise a given crate? I've been trying to use SourceRoot for this, but those contain files for other crates too.</p>



<a name="200253438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200253438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200253438">(Jun 09 2020 at 16:13)</a>:</h4>
<p>Not really -- crates aren't really assembled from files</p>



<a name="200253464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200253464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200253464">(Jun 09 2020 at 16:13)</a>:</h4>
<p>You can walk the tree of modules and collect all module files</p>



<a name="200258152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200258152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200258152">(Jun 09 2020 at 16:45)</a>:</h4>
<div class="codehilite"><pre><span></span><code>   13ms - handle_code_action
       11ms - auto_import::search_for_imports
           11ms - search_for_imports
                0ms - crate_def_map:wait (1 calls)
                9ms - get_name_definition (3 calls)
                1ms - import_map::global_search (1 calls)
            0ms - find_path (5 calls)
</code></pre></div>


<p>That's better (than the &gt;2 seconds it took earlier) <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="200258310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200258310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200258310">(Jun 09 2020 at 16:46)</a>:</h4>
<p>Nice! It even fits in my 16ms vanity goal I have for rust-analyzer :)</p>



<a name="200260433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200260433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200260433">(Jun 09 2020 at 17:03)</a>:</h4>
<p>super exciting for auto-importing completions as well <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span></p>



<a name="200264178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200264178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200264178">(Jun 09 2020 at 17:32)</a>:</h4>
<p>Oh yes, that would be awesome!</p>



<a name="200517282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Import%20map/near/200517282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Import.20map.html#200517282">(Jun 11 2020 at 08:30)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> could you remind what we've decided to do with <a href="https://github.com/rust-analyzer/rust-analyzer/pull/4819#discussion_r438625567">https://github.com/rust-analyzer/rust-analyzer/pull/4819#discussion_r438625567</a>?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>